package com.linkivr.model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class T_module {
	private int mod_id;			//模块编号
	private String mod_name;	//模块名称
	private T_moduletype moduletype;		//模块类型	
	private T_comport comport;	//串口编号
	private int com_addr;		//串口地址
	private String mod_memo;	//模块备注
	
	@Id
	@GeneratedValue
	public int getMod_id() {
		return mod_id;
	}
	public void setMod_id(int modId) {
		mod_id = modId;
	}
	public String getMod_name() {
		if (mod_name==null)
			return "";
		return mod_name;
	}
	public void setMod_name(String modName) {
		mod_name = modName;
	}
	
	@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@JoinColumn(name = "mod_type")
	public T_moduletype getModuletype() {
		return moduletype;
	}
	public void setModuletype(T_moduletype moduletype) {
		this.moduletype = moduletype;
	}
	public String getMod_memo() {
		if (mod_memo==null)
			return "";
		return mod_memo;
	}
	public void setMod_memo(String modMemo) {
		mod_memo = modMemo;
	}
	
	@ManyToOne(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@JoinColumn(name = "com_id")
	public T_comport getComport() {
		return comport;
	}
	public void setComport(T_comport comport) {
		this.comport = comport;
	}
	public int getCom_addr() {
		return com_addr;
	}
	public void setCom_addr(int comAddr) {
		com_addr = comAddr;
	}
	
}
